
import { ElSpace } from 'element-plus';
import { h } from 'vue';
function addIt(it, its) {
    if (it.children) {
        if (Array.isArray(it.children)) {
            it.children.forEach(it1 => addIt(it1, its))
        } else {
            its.push(it);
        }
    }
}

export default {
    name: "MyGridSpace",
    inheritAttrs: true,
    extends: ElSpace,
    render() {
        let props = { ...this.$attrs, ...this.$props };


        return h(ElSpace, props, () => {
            //只有最终有内容的节点才输出到space, 防止生成多余的间隔符 |
            let its = [];
            let itms = this.$slots.default()
            //有children属性，但不是数组的，才是最终需要显示的元素
            itms.forEach(it => addIt(it, its));
            return its;
        });
    }
}
